import sys

from PyQt6.QtGui import QFileSystemModel
from PyQt6.QtWidgets import QApplication, QTreeView

if __name__ == '__main__':
    app = QApplication(sys.argv)
    model = QFileSystemModel()
    model.setRootPath("/Users/miaomiaole/Code/PyQt_init/PyQt_init")
    tree = QTreeView()
    tree.setWindowTitle("pyqt_init")

    tree.setAnimated(False)
    tree.setIndentation(20)
    tree.setSortingEnabled(True)

    tree.setModel(model)
    tree.setRootIndex(model.index('/Users/miaomiaole/Code/PyQt_init/PyQt_init'))

    tree.setColumnWidth(0,200)
    tree.resize(640,480)
    tree.show()
    sys.exit(app.exec())


